<!--
 * @version: 
 * @Author: yu
 * @Date: 2023-07-01 20:09:25
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-04 11:03:02
-->
<template>
    <div>
        <el-table :data="tableData" style="width: 100%;margin-bottom: 20px;" row-key="id" border
            :tree-props="{ children: 'children', hasChildren: 'hasChildren' }">
            <el-table-column prop="id" label="用户编号" sortable width="180"></el-table-column>
            <el-table-column prop="nickname" label="昵称" width="180"></el-table-column>
            <el-table-column prop="phone" label="手机号">

            </el-table-column>

            <el-table-column prop="status" label="状态">
                <template v-slot="item">
                    <el-button v-if="item.row.status === 1" type="primary" size="small">启用</el-button>
                    <el-button v-else type="danger" size="small">禁用</el-button>
                </template>
            </el-table-column>

            <el-table-column label="操作">
                <template slot-scope="scope">
                    <el-button @click="edit(scope.row.uid)" type="primary" size="small">编辑</el-button>
                </template>
            </el-table-column>

        </el-table>
    </div>
</template>
<script>
import { mapActions, mapGetters } from 'vuex'

export default {
    data() {
        return {}
    },
    methods: {
        ...mapActions({
            requestUser: 'user1/listActions'
        }),
        edit(uid) {
            this.$emit('edit', uid)
        },
    },
    mounted() {
        this.requestUser()
    },
    watch: {},
    computed: {
        ...mapGetters({
            tableData: "user1/list"
        })
    },
    filters: {},
    components: {}
}
</script>
<style scoped></style>